package com.realworld.service.Impl;

import com.realworld.common.R;
import com.realworld.mapper.userAttentionMapper;
import com.realworld.service.userAttentionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
public class userAttentionImpl implements userAttentionService {

    @Resource
    private userAttentionMapper userAttentionMapper;

    @Override
    public R followUser(String myName, String username) {
        int i = userAttentionMapper.followUser(myName, username);
        if (i >0 ){
            return R.ok(4001,"关注成功！");
        }
        return R.error(4002,"请勿重复关注！");
    }

    @Override
    public R UnFollowUser(String myName, String username) {
        int i = userAttentionMapper.unfollowUser(myName, username);
        if (i > 0){
            return R.ok(4001,"取关成功！");
        }
        return R.error(4002,"未知错误！");
    }
}
